package org.sbbs.app.license.dao.hibernate;

import org.sbbs.app.license.dao.LicenseInfoDao;
import org.sbbs.app.license.model.LicenseInfo;
import org.sbbs.base.dao.hibernate.BaseDAOImpl;
import org.springframework.stereotype.Repository;

@Repository( "licenseInfoDao" )
public class LicenseInfoDaoHibernate
    extends BaseDAOImpl<LicenseInfo, Long>
    implements LicenseInfoDao {

    @Override
    public void updateCurrentLicense( Long liId ) {
       String hql = "update " + this.persistentClass.getSimpleName() + " set currentUsed=0";
       this.getHibernateTemplate().bulkUpdate( hql );
       String hql1 = "update " + this.persistentClass.getSimpleName() + " set currentUsed=1 where licenseInfoId=?";
       this.getHibernateTemplate().bulkUpdate( hql1, liId );
        
    }

    /*
     * @Override public void updateDisabledFlag( String[] ids, Boolean newflag ) { String hql = "update " +
     * this.persistentClass.getSimpleName() + " set disabled = ?" + " where productId=?"; for ( int i = 0; i <
     * ids.length; i++ ) { this.getHibernateTemplate().bulkUpdate( hql, newflag,ids[i] ); } }
     */

}
